﻿@using IT.CMS.Core.Domain.Customers
@using Telerik.Web.Mvc.UI;
@using IT.CMS.Web.Framework.UI;
@using IT.CMS.Core;
@{
    var currentCustomer = this.WorkContext.CurrentCustomer;
    var usernamesEnabled = EngineContext.Current.Resolve<IT.CMS.Core.Domain.Customers.CustomerSettings>().UsernamesEnabled;
    var currentVersion = CmsVersion.CurrentVersion;

    //resources
    Html.AppendCssFileParts("~/Areas/Admin/Content/styles.css");

    Html.AppendCssFileParts("~/Content/bootstrap.css");
    Html.AppendCssFileParts("~/Content/bootstrap-responsive.min.css");
    
    
    Html.AppendCssFileParts("~/Content/font-awesome.css");
    Html.AppendCssFileParts("~/Content/stacked-pills.css");
    Html.AppendCssFileParts("~/Content/icomoon.css");

    Html.AppendScriptParts("~/Areas/Admin/Scripts/admin.common.js");
    Html.AppendScriptParts("~/Areas/Admin/Scripts/jquery.validate.unobtrusive.min.js");
    Html.AppendScriptParts("~/Areas/Admin/Scripts/jquery.validate.min.js");
    Html.AppendScriptParts("~/Areas/Admin/Scripts/jquery.unobtrusive-ajax.min.js");
    Html.AppendScriptParts("~/Areas/Admin/Scripts/jquery-1.7.1.min.js");
    
    // Html.AppendScriptParts("~/Scripts/bootstrap.js");

    //page title
    string adminPageTitle = "";
    if (!String.IsNullOrWhiteSpace(ViewBag.Title))
    {
        adminPageTitle = ViewBag.Title + " / ";
    }
    adminPageTitle += T("Admin.PageTitle").Text;
}
<!DOCTYPE html>
<html>
<head>
    <title>@adminPageTitle</title>
    <meta http-equiv="Content-type" content="text/html;charset=UTF-8" />
    @Html.CmsCssFiles(this.Url, ResourceLocation.Head)

    @Html.CmsScripts(this.Url, ResourceLocation.Head)
</head>
<body>
    <div class="master-wrapper-page">
        <div class="master-wrapper-content">
            @if (IsSectionDefined("header"))
            {
                @RenderSection("header")
            }
            else
            {
                <script type="text/javascript">
                    $(document).ready(function () {
                        $("#restart-application").click(function (e) {
                            showThrobber('@T("Admin.Header.RestartApplication.Progress")');
                        });
                    });
                </script>
                <div class="header">


            <div id="user-nav" class="navbar navbar-inverse">
            <ul class="nav btn-group" style="width: auto; margin: 0px;">

                <li class="btn btn-inverse"><a title="" href="@Url.Action("Index", "Home", new { area = "" }, null)"><i class="icon-user"></i><span class="text"> @T("Admin.Header.PublicSite").Text</span></a></li>
                
                
                <li class="btn btn-inverse dropdown"><a href="#" data-toggle="dropdown" class="dropdown-toggle"><i class="icon icon-envelope"></i> 
                    <span class="text">Messages</span> <span class="label label-important">5</span> <b class="caret"></b></a>
						<ul class="dropdown-menu">


							<li><a href="./account.html"><i class="icon-user"></i> Account Setting</a></li>
							<li><a href="./change_password.html"><i class="icon-lock"></i> Change Password</a></li>
							<li class="divider"></li><li>
								<a href="@Url.Action("Logout", "Customer", new { area = "" }, null)"><i class="icon-off"></i> Logout</a>
							</li>
						</ul>
                </li>


                
                @if (currentCustomer != null && currentCustomer.IsRegistered())
                        {
                <li class="btn btn-inverse dropdown"><a href="#" data-toggle="dropdown" class="dropdown-toggle"><i class="icon icon-envelope"></i> 
                    <span class="text">Messages</span> <span class="label label-important">5</span> <b class="caret"></b></a>
						<ul class="dropdown-menu">


							<li><i class="icon-user"></i><span>@String.Format(usernamesEnabled ? currentCustomer.Username : currentCustomer.Email)</span></li>
							<li><a href="./change_password.html"><i class="icon-lock"></i> Change Password</a></li>
							<li class="divider"></li><li>
								<a href="@Url.Action("Logout", "Customer", new { area = "" }, null)"><i class="icon-off"></i> @T("Admin.Header.Logout").Text</a>
							</li>
						</ul>
                </li>
                }
                
                <li class="btn btn-inverse dropdown"><a title="" href="#" data-toggle="dropdown"><i class="icon-cog"></i><span class="text">Settings</span></a>
                    		<ul class="dropdown-menu">



                            <li><a href="@Url.Action("ClearCache", "Common")"><i class="icon-user"></i> @T("Admin.Header.ClearCache").Text</a></li>
                            <li><a href="@Url.Action("RestartApplication", "Common")" id="restart-application"><i class="icon-user"></i> @T("Admin.Header.RestartApplication").Text</a></li>

							<li><a href="./change_password.html"><i class="icon-lock"></i> Change Password</a></li>
							<li class="divider"></li><li>
								<a href="@Url.Action("Logout", "Customer", new { area = "" }, null)"><i class="icon-off"></i> Logout</a>
							</li>
						</ul>


                </li>
                <li class="btn btn-inverse"><a title="" href="@Url.Action("Logout", "Customer", new { area = "" }, null)"><i class="icon-share-alt"></i><span class="text"> @T("Admin.Header.Logout").Text</span></a></li>
            </ul>
        </div>
 @*<div class="logo"></div>*@
                    @Html.Widget("admin_header_before")
                    <div class="languageselector">
                        @Html.Action("LanguageSelector", "Common")
                    </div>
                    @Html.Widget("admin_header_middle")


                    @Html.Widget("admin_header_after")
                </div>
                <div class="clear">
                </div>
            }
            @if (IsSectionDefined("headermenu"))
            {
                @RenderSection("headermenu")
            }
            else
            {

                @*    
                <div class="header-menu">
                    @Html.Partial("Menu")
                </div>
           
                 *@
                

            }
            @if (IsSectionDefined("statusbar"))
            {
                @RenderSection("statusbar")
            }
            else
            {
                @*
                <div class="status-bar">
                    <div class="help">
                    </div>
                    <div class="breadcrumb">
                        <!-- SiteMapPath here-->
                    @Html.Widget("admin_breadcrumb")
                    </div>
                </div>
                *@
                <div class="clear">
                </div>
            }
            <div class="content">
		
                @* @Html.Partial("_Vertical_Menu")*@

                @Html.VerticalMenu();



                @*
                
                @{
                    
                    if (!Telerik.Web.Mvc.SiteMapManager.SiteMaps.ContainsKey("Vertical_Menu"))
                    {
                        Telerik.Web.Mvc.SiteMapManager.SiteMaps.Register<Telerik.Web.Mvc.XmlSiteMap>("Vertical_Menu", sitemap => sitemap.LoadFrom("~/Areas/Admin/Vertical_Menu.config"));
                    }

                    Telerik.Web.Mvc.XmlSiteMap SiteDic = (Telerik.Web.Mvc.XmlSiteMap)Telerik.Web.Mvc.SiteMapManager.SiteMaps["Vertical_Menu"];

                    foreach (var item in SiteDic.RootNode.ChildNodes)
                    {
                        var resourceName = item.Attributes["cmsResource"];
                        var iconClass = item.Attributes["IconClass"];
                        var action = item.ActionName;
                        var controller = item.ControllerName;
                        

                        if (resourceName != null && action != null && controller != null && !string.IsNullOrEmpty(resourceName.ToString()))
                        {

                            if (!String.IsNullOrWhiteSpace(controller.ToString()) && !String.IsNullOrWhiteSpace(action.ToString()))
                            {
                                <li>        
                                <a href="@Url.Action(action.ToString(), controller.ToString(), new RouteValueDictionary() { { "area", "Admin" } })">
								<i class="@iconClass.ToString()"></i>
				    			<span>@T(resourceName.ToString()).ToHtmlString()</span>
					    		</a>
                                </li>
                            }
                        }
                        else
                        {

                           if (item.ChildNodes.Count > 0)
                            {
                                <li class="dropdown">        
                                <a href="#" class="dropdown-toggle" data-toggle="dropdown">
								<i class="@iconClass.ToString()"></i>
				    			<span>@T(resourceName.ToString()).ToHtmlString()</span>
					    		</a>
                                <ul class="dropdown-menu">
                                    @foreach (var Childitem in item.ChildNodes)
                                    {
                                        var resourceName2 = Childitem.Attributes["cmsResource"];
                                        <li><a href="#"><span>@T(resourceName2.ToString()).ToHtmlString()</span></a></li>        
                                    }
							    </ul>
                                </li>
                                
                            } else {
                                <li>        
                                <a href="#">
								<i class="@iconClass.ToString()"></i>
				    			<span>@T(resourceName.ToString()).ToHtmlString()</span>
					    		</a>
                                </li>
                            
                            }


                        }

                    }
                    }

						<li class="dropdown">
							<a href="#" class="dropdown-toggle" data-toggle="dropdown">
								<i class="micon-newspaper"></i>
								<span>Posts</span>
								<span class="badge">4</span>
							</a>
							<ul class="dropdown-menu">
								<li><a href="#">Action</a></li>
								<li><a href="#">Another action</a></li>
								<li><a href="#">Something else here</a></li>
								<li class="divider"></li>
								<li class="nav-header">Nav header</li>
								<li><a href="#">Separated link</a></li>
								<li><a href="#">One more separated link</a></li>
							</ul>
						</li>
						<li class="dropdown active">
							<a href="#" class="dropdown-toggle" data-toggle="dropdown">
								<i class="micon-paper"></i>
								<span>Pages</span>
								<span class="badge">10</span>
							</a>
							<ul class="dropdown-menu">
								<li><a href="#">Action</a></li>
								<li><a href="#">Another action</a></li>
								<li><a href="#">Something else here</a></li>
								<li class="divider"></li>
								<li class="nav-header">Nav header</li>
								<li><a href="#">Separated link</a></li>
								<li><a href="#">One more separated link</a></li>
							</ul>
						</li>
						<li class="dropdown">
							<a href="#" class="dropdown-toggle" data-toggle="dropdown">
								<i class="micon-picture"></i>
								<span>Media</span>
								<span class="badge">12</span>
							</a>
							<ul class="dropdown-menu">
								<li><a href="#">Action</a></li>
								<li><a href="#">Another action</a></li>
								<li><a href="#">Something else here</a></li>
								<li class="divider"></li>
								<li class="nav-header">Nav header</li>
								<li><a href="#">Separated link</a></li>
								<li><a href="#">One more separated link</a></li>
							</ul>
						</li>
						<li>
							<a href="#">
								<i class="micon-comments-2"></i>
								<span>Comments</span>
							</a>
						</li>
						<li>
							<a href="#">
								<i class="micon-key-2"></i>
								<span>Settings</span>
							</a>
						</li>
					</ul>
                *@


<div class="tm_pad-shadow">
        <div class="tm_lifted ">
            <div class="tm_text-shadow">      


                @Html.Partial("Notifications")
                <div class="cph">
                    @RenderBody()
                </div>
</div></div></div>





            </div>






            <div class="throbber">
                <div class="curtain">
                </div>
                <div class="curtain-content">
                    <div>
                        <h1 class="throbber-header">Wait...</h1>
                        <p>
                            <img src="@Url.Content("~/Areas/Admin/content/images/throbber-synchronizing.gif")" alt="" />
                        </p>
                    </div>
                </div>
            </div>
        </div>
    </div>


    <!--These need to be at the end of the page to ensure that all the controls requiring scripts have been rendered-->
    @(Html.Telerik().StyleSheetRegistrar()
        .DefaultGroup(group => group
            .Add("telerik.common.min.css")
            .Add("telerik.Sitefinity.min.css")
            .Add("telerik.rtl.min.css")
            //uncomment the lines below in order to combine and compress CSS files
            //.Combined(true)
            //.Compress(true)
            ))
    @(Html.Telerik().ScriptRegistrar()
            .jQuery(false)
            .jQueryValidation(false)
            )
    @Html.CmsCssFiles(this.Url, ResourceLocation.Foot)
    @Html.CmsScripts(this.Url, ResourceLocation.Foot)
    @System.Web.Optimization.Scripts.Render("~/Scripts/bootstrap.min.js")


</body>
</html>
